package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLdJb;
import com.huizu.project.service.IProLdJbService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 劳动级别配置Controller
 * 
 * @author zhangmx
 * @date 2024-05-11
 */
@RestController
@RequestMapping("/project/proldjb")
public class ProLdJbController extends BaseController
{
    @Autowired
    private IProLdJbService proLdJbService;

    /**
     * 查询劳动级别配置列表
     */
    @PreAuthorize("@ss.hasPermi('project:proldjb:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLdJb proLdJb)
    {
        startPage();
        List<ProLdJb> list = proLdJbService.selectProLdJbList(proLdJb);
        return getDataTable(list);
    }

    /**
     * 导出劳动级别配置列表
     */
    @PreAuthorize("@ss.hasPermi('project:proldjb:export')")
    @Log(title = "劳动级别配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLdJb proLdJb)
    {
        List<ProLdJb> list = proLdJbService.selectProLdJbList(proLdJb);
        ExcelUtil<ProLdJb> util = new ExcelUtil<ProLdJb>(ProLdJb.class);
        util.exportExcel(response, list, "劳动级别配置数据");
    }

    /**
     * 获取劳动级别配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:proldjb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLdJbService.selectProLdJbById(id));
    }

    /**
     * 新增劳动级别配置
     */
    @PreAuthorize("@ss.hasPermi('project:proldjb:add')")
    @Log(title = "劳动级别配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLdJb proLdJb)
    {
        return toAjax(proLdJbService.insertProLdJb(proLdJb));
    }

    /**
     * 修改劳动级别配置
     */
    @PreAuthorize("@ss.hasPermi('project:proldjb:edit')")
    @Log(title = "劳动级别配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLdJb proLdJb)
    {
        return toAjax(proLdJbService.updateProLdJb(proLdJb));
    }

    /**
     * 删除劳动级别配置
     */
    @PreAuthorize("@ss.hasPermi('project:proldjb:remove')")
    @Log(title = "劳动级别配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLdJbService.deleteProLdJbByIds(ids));
    }
}
